package com.cci.zkweb.core.entity.p8;

import java.io.Serializable;

import com.cci.zkweb.core.util.ZKFUtils;

/**
 * Document specific implementation
 * @author durzod
 */
public class Document 
extends P8Object
implements Serializable {
	private static final long serialVersionUID = 964881196176184832L;

	private String extension;
	
	public void setName(String name) {
		super.setName(name);
		if(name.contains(".")) {
			this.extension = name.substring(name.lastIndexOf("."));
		}
	}
	
	public String getExtension() {
		return extension;
	}
	
	public void setExtension(String extension) {
		this.extension = extension;
	}

	/**
	 * Get MIME-TYPE associated icon
	 * @return
	 */
	@Override
	public String getIcon() {
		return String.format(ZKFUtils.MIME_IMAGE_PATH, ZKFUtils.getMimeTypeIcon(getMimeType()));
	}

	@Override
	public boolean isFolder() {
		return false;
	}
}
